
!  --------------------------------------------------
!  Silverfrost FTN95 for Microsoft Visual Studio
!  Free Format FTN95 Source File
!
  --------------------------------------------------
  
! program BagiDua
! implicit none
!double precision epsilon, answer, x1, x2
!parameter (epsilon = 1.E-5)
!parameter (x1=1.E-3)
!parameter (x2=999*1.E-3)
!call metodebagidua (epsilon,x1,x2,answer)
!print*,answer
!pause
!end



subroutine metodebagidua (eps,a,b,jawaban)
implicit none 
double precision a,b,c,fa,fc,jawaban,eps,mof
fa = mof(a)
do while ((abs(a-b) .LT. eps) .or. (fc .EQ. 0))
    c = (a+b)/2
    fc = mof(c)
    jawaban = c
    if (fa*fc > 0) then
        b = c
    else
        a = c
    endif
    jawaban = c
end do
end

!double precision function mof(x)
!implicit none
!double precision x
!mof = (((x*(2.1-(0.5*x)))**0.5)/((1-x)*((1.1-(0.5*x))**0.5)))-3.69
!end